package com.softer.wxzj.controller;

import com.github.pagehelper.PageInfo;
import com.softer.wxzj.common.entity.Page;
import com.softer.wxzj.entity.ExpPayReq;
import com.softer.wxzj.entity.ExpProjectReq;
import com.softer.wxzj.entity.ReqList;
import com.softer.wxzj.service.ExpProjectSearchService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 使用查询
 *
 * @author Gong Zhiyang
 * @date 2019/8/20
 */
@RestController
@RequestMapping("/expProjectSearch")
public class ExpProjectSearchController {
    @Autowired
    private ExpProjectSearchService expProjectSearchService;

    /**
     * 项目信息查询列表
     *
     * @param page          分页实体
     * @param expProjectReq 查询实体
     * @return 项目列表
     */
    @PostMapping("/getProjectList")
    public PageInfo<ExpProjectReq> getProjectList(Page page, ExpProjectReq expProjectReq) {
        return expProjectSearchService.getProjectList(page, expProjectReq);
    }

    /**
     * 到期维修项目查询列表
     *
     * @param page          分页实体
     * @param expProjectReq 查询实体
     * @return 项目列表
     */
    @PostMapping("/getExpirationDateLists")
    public PageInfo<ExpProjectReq> getExpirationDateList(Page page, ExpProjectReq expProjectReq) {
        return expProjectSearchService.getExpirationDateList(page, expProjectReq);
    }

    /**
     * 拨款、付款信息查询
     * (付款信息时，只查询已经记账的信息)
     *
     * @param expPayReq 查询实体
     * @return 拨款、付款信息
     */
    @PostMapping("/getExpPayReqInfo")
    public ReqList expPayReqInfoList(ExpPayReq expPayReq, String arcType) {
        return expProjectSearchService.expPayReqInfoList(expPayReq, arcType);
    }

    /**
     * 使用查询流程图对应当前项目的状态
     *
     * @return
     */
    @RequestMapping("/step")
    public String step(String id) {
        return expProjectSearchService.step(id);
    }

    /**
     * 拨款表头信息汇总
     *
     * @param id 项目id
     * @return 汇总信息
     */
    @RequestMapping("/expGrantInfoSum")
    public ExpProjectReq expGrantInfoSum(String id) {
        return expProjectSearchService.expGrantInfoSum(id);
    }
}
